<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.util.DateTime"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.is.model.TeacherAssess"%>
<%@page import="java.util.List"%>
<%@page import="com.is.util.ParamUtil"%>
<%@page import="com.is.control.TeacherAssessControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../../resources/css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<script type="text/javascript" src="../../resources/js/jquery.artDialog.js"></script>
<title>Insert title here</title>
</head>
<body>
<% 
	 String time_now = DateTime.SimpleDate();
	 String time = ParamUtil.getString(request,"t_time",time_now);
	 String t_work = ParamUtil.getString(request,"t_work","0.0");
	 String t_absent = ParamUtil.getString(request,"t_absent","0.0");
	 String t_extra = ParamUtil.getString(request,"t_extra","0.0");
	 String t_vacate = ParamUtil.getString(request,"t_vacate","0.0");
	 int u_id = ParamUtil.getInt(request,"u_id");
	 int course_class_id = ParamUtil.getInt(request,"course_class_id");
	 //String course_id = ParamUtil.getString(request,"course_id");
	 TeacherAssess ta = new TeacherAssess();
	 ta.setClassAmount(t_work);
	 ta.setAbsentAmount(t_absent);
	 ta.setExtraAmount(t_extra);
	 ta.setLeaveAmount(t_vacate);
	 ta.setUid(u_id);
	 ta.setCourseClassId(course_class_id);
	 ta.setTime(time);
	 if(TeacherAssessControl.insertTeacherSingleAssess(ta)){//同时会更新course_Class中realTotalClass的值
%>
	<script type="text/javascript">
	$.dialog({
	    title: '教师考核',
	    content: '系统已将你的考核情况记录',
	    icon: 'succeed',
	    ok: function(){
			window.location.href = "teacher_assess.jsp";
	    }
	});
	//	alert("添加成功!");
	//	window.location.href = "teacher_assess.jsp";
	</script>
<%	 
	 } else{
%>
	<script type="text/javascript">
	 $.dialog({
		    title: '教师考核',
		    content: '抱歉，系统出现错误或您录入的信息有误，本次录入信息均无效，请重试',
		    icon: 'warning',
		    ok: function(){
		         history.go(-1);
		    }
		});
		 //alert("抱歉，系统出现错误或您录入的信息有误，本次录入信息均无效，请重试");
         //history.go(-1);
	</script>
<% 
	 }
%>
</body>
</html>